<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: BaseNetwLayer Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00028.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="#pri-methods">Private Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">BaseNetwLayer Class Reference<div class="ingroups"><a class="el" href="a00507.html">netwLayer - network layer modules</a> &#124; <a class="el" href="a00516.html">baseModules - base module classes of MiXiM</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="BaseNetwLayer" --><!-- doxytag: inherits="BaseLayer" -->
<p>Base class for the network layer.  
 <a href="a00028.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="a00274_source.html">BaseNetwLayer.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for BaseNetwLayer:</div>
<div class="dyncontent">
<div class="center"><img src="a00596.png" border="0" usemap="#BaseNetwLayer_inherit__map" alt="Inheritance graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for BaseNetwLayer:</div>
<div class="dyncontent">
<div class="center"><img src="a00597.png" border="0" usemap="#BaseNetwLayer_coll__map" alt="Collaboration graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="a00598.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#ae9b454fb23adb3ba3d2fe487f507ffab">BaseNetwMessageKinds</a> { <a class="el" href="a00028.html#ae9b454fb23adb3ba3d2fe487f507ffaba0739a621763c662b0064f1f92644ae05">LAST_BASE_NETW_MESSAGE_KIND</a> =  24000
 }</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Message kinds used by this layer.  <a href="a00028.html#ae9b454fb23adb3ba3d2fe487f507ffab">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#aca717c433c9975c6cbbc8f3ec8ce8af4">BaseNetwControlKinds</a> { <a class="el" href="a00028.html#aca717c433c9975c6cbbc8f3ec8ce8af4a9d1de6d232d7ba06347a8c4f77477b89">LAST_BASE_NETW_CONTROL_KIND</a> =  24500
 }</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Control message kinds used by this layer.  <a href="a00028.html#aca717c433c9975c6cbbc8f3ec8ce8af4">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a70ef917f412c70e361b698d6989e677f"></a><!-- doxytag: member="BaseNetwLayer::netwpkt_ptr_t" ref="a70ef917f412c70e361b698d6989e677f" args="" -->
typedef NetwPkt *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#a70ef917f412c70e361b698d6989e677f">netwpkt_ptr_t</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">network packet pointer type. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6a2b54b843abb985471f228b93785b8b"></a><!-- doxytag: member="BaseNetwLayer::BaseNetwLayer" ref="a6a2b54b843abb985471f228b93785b8b" args="(unsigned stacksize)" -->
&#160;</td><td class="memItemRight" valign="bottom"><b>BaseNetwLayer</b> (unsigned stacksize)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1e521b5549bfe29ae94d95265c0fe8d2"></a><!-- doxytag: member="BaseNetwLayer::initialize" ref="a1e521b5549bfe29ae94d95265c0fe8d2" args="(int)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#a1e521b5549bfe29ae94d95265c0fe8d2">initialize</a> (int)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialization of the module and some variables. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual cMessage *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#a5e35aa24556a7cab9b6658889e98cb74">decapsMsg</a> (<a class="el" href="a00028.html#a70ef917f412c70e361b698d6989e677f">netwpkt_ptr_t</a>)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">decapsulate higher layer message from NetwPkt  <a href="#a5e35aa24556a7cab9b6658889e98cb74"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="a00028.html#a70ef917f412c70e361b698d6989e677f">netwpkt_ptr_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#aad9d232f77fa033ffa2f1e7abe8e4af6">encapsMsg</a> (cPacket *)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Encapsulate higher layer packet into an NetwPkt.  <a href="#aad9d232f77fa033ffa2f1e7abe8e4af6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual cObject *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#a627a9f853785bc061b1423ac6ad9ad21">setDownControlInfo</a> (cMessage *const pMsg, const <a class="el" href="a00117.html#aea56b60dcb5ae8c2bde465271daf7210">LAddress::L2Type</a> &amp;pDestAddr)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Attaches a "control info" (NetwToMac) structure (object) to the message pMsg.  <a href="#a627a9f853785bc061b1423ac6ad9ad21"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual cObject *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#a701bcbce5b46085ad3c987aecfd84010">setUpControlInfo</a> (cMessage *const pMsg, const <a class="el" href="a00117.html#ad85cd9e8d9e7e9cd5d02dd740c4a12a4">LAddress::L3Type</a> &amp;pSrcAddr)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Attaches a "control info" (NetwToUpper) structure (object) to the message pMsg.  <a href="#a701bcbce5b46085ad3c987aecfd84010"></a><br/></td></tr>
<tr><td colspan="2"><div class="groupHeader">Handle Messages</div></td></tr>
<tr><td colspan="2"><div class="groupText"><p>Functions to redefine by the programmer</p>
<p>These are the functions provided to add own functionality to your modules. These functions are called whenever a self message or a data message from the upper or lower layer arrives respectively. </p>
</div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#a0b473fbb2517ac7b0c633afdb002c269">handleUpperMsg</a> (cMessage *msg)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle messages from upper layer.  <a href="#a0b473fbb2517ac7b0c633afdb002c269"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#a58afc64e0a96fe4d80d6b9f53cfd53c6">handleLowerMsg</a> (cMessage *msg)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle messages from lower layer.  <a href="#a58afc64e0a96fe4d80d6b9f53cfd53c6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1b6a30a1442d646a41df5acc7ef1e047"></a><!-- doxytag: member="BaseNetwLayer::handleSelfMsg" ref="a1b6a30a1442d646a41df5acc7ef1e047" args="(cMessage *)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#a1b6a30a1442d646a41df5acc7ef1e047">handleSelfMsg</a> (cMessage *)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle self messages. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#a478dcd88ab7a82412deb8075afe61278">handleLowerControl</a> (cMessage *msg)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle control messages from lower layer.  <a href="#a478dcd88ab7a82412deb8075afe61278"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad06c4c45457946b3abbfe68d5533575d"></a><!-- doxytag: member="BaseNetwLayer::handleUpperControl" ref="ad06c4c45457946b3abbfe68d5533575d" args="(cMessage *)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#ad06c4c45457946b3abbfe68d5533575d">handleUpperControl</a> (cMessage *)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle control messages from lower layer. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9b802bd94a739e6202690d743ecc83a2"></a><!-- doxytag: member="BaseNetwLayer::headerLength" ref="a9b802bd94a739e6202690d743ecc83a2" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#a9b802bd94a739e6202690d743ecc83a2">headerLength</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Length of the NetwPkt header Read from omnetpp.ini. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a57d8927211b7979cf801038333ffdd50"></a><!-- doxytag: member="BaseNetwLayer::arp" ref="a57d8927211b7979cf801038333ffdd50" args="" -->
<a class="el" href="a00015.html">ArpInterface</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#a57d8927211b7979cf801038333ffdd50">arp</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to the arp module. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7df0d33fcf757b2e63af619f28bf3312"></a><!-- doxytag: member="BaseNetwLayer::myNetwAddr" ref="a7df0d33fcf757b2e63af619f28bf3312" args="" -->
<a class="el" href="a00117.html#ad85cd9e8d9e7e9cd5d02dd740c4a12a4">LAddress::L3Type</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#a7df0d33fcf757b2e63af619f28bf3312">myNetwAddr</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">cached variable of my networ address <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7420f776d8b4017a42781c38ad8b142a"></a><!-- doxytag: member="BaseNetwLayer::coreDebug" ref="a7420f776d8b4017a42781c38ad8b142a" args="" -->
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#a7420f776d8b4017a42781c38ad8b142a">coreDebug</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Enables debugging of this module. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aee611df05c5866cfead2ec23b2593e65"></a><!-- doxytag: member="BaseNetwLayer::BaseNetwLayer" ref="aee611df05c5866cfead2ec23b2593e65" args="(const BaseNetwLayer &amp;)" -->
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#aee611df05c5866cfead2ec23b2593e65">BaseNetwLayer</a> (const <a class="el" href="a00028.html">BaseNetwLayer</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor is not allowed. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac736985952cb46f7340488218e23ae57"></a><!-- doxytag: member="BaseNetwLayer::operator=" ref="ac736985952cb46f7340488218e23ae57" args="(const BaseNetwLayer &amp;)" -->
<a class="el" href="a00028.html">BaseNetwLayer</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00028.html#ac736985952cb46f7340488218e23ae57">operator=</a> (const <a class="el" href="a00028.html">BaseNetwLayer</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Assignment operator is not allowed. <br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Base class for the network layer. </p>
<dl class="author"><dt><b>Author:</b></dt><dd>Daniel Willkomm </dd></dl>
</div><hr/><h2>Member Enumeration Documentation</h2>
<a class="anchor" id="aca717c433c9975c6cbbc8f3ec8ce8af4"></a><!-- doxytag: member="BaseNetwLayer::BaseNetwControlKinds" ref="aca717c433c9975c6cbbc8f3ec8ce8af4" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="a00028.html#aca717c433c9975c6cbbc8f3ec8ce8af4">BaseNetwLayer::BaseNetwControlKinds</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Control message kinds used by this layer. </p>
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="aca717c433c9975c6cbbc8f3ec8ce8af4a9d1de6d232d7ba06347a8c4f77477b89"></a><!-- doxytag: member="LAST_BASE_NETW_CONTROL_KIND" ref="aca717c433c9975c6cbbc8f3ec8ce8af4a9d1de6d232d7ba06347a8c4f77477b89" args="" -->LAST_BASE_NETW_CONTROL_KIND</em>&nbsp;</td><td>
<p>Stores the id on which classes extending BaseNetw should continue their own control kinds. </p>
</td></tr>
</table>
</dd>
</dl>
<div class="fragment"><pre class="fragment">                            {
    <a class="code" href="a00028.html#aca717c433c9975c6cbbc8f3ec8ce8af4a9d1de6d232d7ba06347a8c4f77477b89" title="Stores the id on which classes extending BaseNetw should continue their own control kinds...">LAST_BASE_NETW_CONTROL_KIND</a> = 24500,
  };
</pre></div>
</div>
</div>
<a class="anchor" id="ae9b454fb23adb3ba3d2fe487f507ffab"></a><!-- doxytag: member="BaseNetwLayer::BaseNetwMessageKinds" ref="ae9b454fb23adb3ba3d2fe487f507ffab" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="a00028.html#ae9b454fb23adb3ba3d2fe487f507ffab">BaseNetwLayer::BaseNetwMessageKinds</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Message kinds used by this layer. </p>
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="ae9b454fb23adb3ba3d2fe487f507ffaba0739a621763c662b0064f1f92644ae05"></a><!-- doxytag: member="LAST_BASE_NETW_MESSAGE_KIND" ref="ae9b454fb23adb3ba3d2fe487f507ffaba0739a621763c662b0064f1f92644ae05" args="" -->LAST_BASE_NETW_MESSAGE_KIND</em>&nbsp;</td><td>
<p>Stores the id on which classes extending BaseNetw should continue their own message kinds. </p>
</td></tr>
</table>
</dd>
</dl>
<div class="fragment"><pre class="fragment">                            {
    <a class="code" href="a00028.html#ae9b454fb23adb3ba3d2fe487f507ffaba0739a621763c662b0064f1f92644ae05" title="Stores the id on which classes extending BaseNetw should continue their own message kinds...">LAST_BASE_NETW_MESSAGE_KIND</a> = 24000,
  };
</pre></div>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a5e35aa24556a7cab9b6658889e98cb74"></a><!-- doxytag: member="BaseNetwLayer::decapsMsg" ref="a5e35aa24556a7cab9b6658889e98cb74" args="(netwpkt_ptr_t)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cMessage * BaseNetwLayer::decapsMsg </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="a00028.html#a70ef917f412c70e361b698d6989e677f">netwpkt_ptr_t</a>&#160;</td>
          <td class="paramname"><em>msg</em></td><td>)</td>
          <td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>decapsulate higher layer message from NetwPkt </p>
<p>Decapsulates the packet from the received Network packet </p>

<p>Reimplemented in <a class="el" href="a00180.html#a4a0384a5fb7b18557c33c6b2ead5722d">ProbabilisticBroadcast</a>, and <a class="el" href="a00089.html#a04dfae1582e817482ed118d1325f082d">DummyRoute</a>.</p>

<p>References <a class="el" href="a00028.html#a701bcbce5b46085ad3c987aecfd84010">setUpControlInfo()</a>.</p>

<p>Referenced by <a class="el" href="a00028.html#a58afc64e0a96fe4d80d6b9f53cfd53c6">handleLowerMsg()</a>, and <a class="el" href="a00094.html#ac8c12c3b58ff0f5092b2326f694a509e">Flood::handleLowerMsg()</a>.</p>
<div class="fragment"><pre class="fragment">{
    cMessage *m = msg-&gt;decapsulate();
    <a class="code" href="a00028.html#a701bcbce5b46085ad3c987aecfd84010" title="Attaches a &quot;control info&quot; (NetwToUpper) structure (object) to the message pMsg.">setUpControlInfo</a>(m, msg-&gt;getSrcAddr());
    <span class="comment">// delete the netw packet</span>
    <span class="keyword">delete</span> msg;
    <span class="keywordflow">return</span> m;
}
</pre></div>
</div>
</div>
<a class="anchor" id="aad9d232f77fa033ffa2f1e7abe8e4af6"></a><!-- doxytag: member="BaseNetwLayer::encapsMsg" ref="aad9d232f77fa033ffa2f1e7abe8e4af6" args="(cPacket *)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a00028.html#a70ef917f412c70e361b698d6989e677f">BaseNetwLayer::netwpkt_ptr_t</a> BaseNetwLayer::encapsMsg </td>
          <td>(</td>
          <td class="paramtype">cPacket *&#160;</td>
          <td class="paramname"><em>appPkt</em></td><td>)</td>
          <td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Encapsulate higher layer packet into an NetwPkt. </p>
<p>Encapsulates the received ApplPkt into a NetwPkt and set all needed header fields. </p>

<p>Reimplemented in <a class="el" href="a00094.html#a4576a635c66d17c2a4f05cc6ee524791">Flood</a>, <a class="el" href="a00180.html#a3fe5edff45548230ba917138683fd6fa">ProbabilisticBroadcast</a>, and <a class="el" href="a00089.html#a20ab170f205c2834e998b7bbf91043c0">DummyRoute</a>.</p>

<p>References <a class="el" href="a00028.html#a57d8927211b7979cf801038333ffdd50">arp</a>, <a class="el" href="a00155.html#a75c4c6c2073fcd17b73583b7243e8d21">NetwControlInfo::getAddressFromControlInfo()</a>, <a class="el" href="a00015.html#a793bf2888740e48020eacbceaac211c2">ArpInterface::getMacAddr()</a>, <a class="el" href="a00028.html#a9b802bd94a739e6202690d743ecc83a2">headerLength</a>, <a class="el" href="a00117.html#a97a5c1c1f73f4255cabc4e292c4ad503">LAddress::isL3Broadcast()</a>, <a class="el" href="a00117.html#a9f975ad0433f1fb8a01164f266a41f62">LAddress::L2BROADCAST</a>, <a class="el" href="a00117.html#a11d63e8d897e072ed94da77028d38f60">LAddress::L3BROADCAST</a>, <a class="el" href="a00028.html#a7df0d33fcf757b2e63af619f28bf3312">myNetwAddr</a>, and <a class="el" href="a00028.html#a627a9f853785bc061b1423ac6ad9ad21">setDownControlInfo()</a>.</p>

<p>Referenced by <a class="el" href="a00028.html#a0b473fbb2517ac7b0c633afdb002c269">handleUpperMsg()</a>.</p>
<div class="fragment"><pre class="fragment">                                                                   {
    <a class="code" href="a00117.html#aea56b60dcb5ae8c2bde465271daf7210" title="Type definition for a L2 (MAC) address.">LAddress::L2Type</a> macAddr;
    <a class="code" href="a00117.html#ad85cd9e8d9e7e9cd5d02dd740c4a12a4" title="Type definition for a L3 (Network) address.">LAddress::L3Type</a> netwAddr;

    coreEV &lt;&lt;<span class="stringliteral">&quot;in encaps...\n&quot;</span>;

    <a class="code" href="a00028.html#a70ef917f412c70e361b698d6989e677f" title="network packet pointer type.">netwpkt_ptr_t</a> pkt = <span class="keyword">new</span> NetwPkt(appPkt-&gt;getName(), appPkt-&gt;getKind());
    pkt-&gt;setBitLength(<a class="code" href="a00028.html#a9b802bd94a739e6202690d743ecc83a2" title="Length of the NetwPkt header Read from omnetpp.ini.">headerLength</a>);

    cObject* cInfo = appPkt-&gt;removeControlInfo();

    <span class="keywordflow">if</span>(cInfo == NULL){
  EV &lt;&lt; <span class="stringliteral">&quot;warning: Application layer did not specifiy a destination L3 address\n&quot;</span>
     &lt;&lt; <span class="stringliteral">&quot;\tusing broadcast address instead\n&quot;</span>;
  netwAddr = <a class="code" href="a00117.html#a11d63e8d897e072ed94da77028d38f60" title="Broadcast address for L3 addresses.">LAddress::L3BROADCAST</a>;
    } <span class="keywordflow">else</span> {
  coreEV &lt;&lt;<span class="stringliteral">&quot;CInfo removed, netw addr=&quot;</span>&lt;&lt; <a class="code" href="a00155.html#a75c4c6c2073fcd17b73583b7243e8d21" title="extracts the address from &quot;control info&quot;.">NetwControlInfo::getAddressFromControlInfo</a>( cInfo ) &lt;&lt; std::endl;
        netwAddr = <a class="code" href="a00155.html#a75c4c6c2073fcd17b73583b7243e8d21" title="extracts the address from &quot;control info&quot;.">NetwControlInfo::getAddressFromControlInfo</a>( cInfo );
  <span class="keyword">delete</span> cInfo;
    }

    pkt-&gt;setSrcAddr(<a class="code" href="a00028.html#a7df0d33fcf757b2e63af619f28bf3312" title="cached variable of my networ address">myNetwAddr</a>);
    pkt-&gt;setDestAddr(netwAddr);
    coreEV &lt;&lt; <span class="stringliteral">&quot; netw &quot;</span>&lt;&lt; <a class="code" href="a00028.html#a7df0d33fcf757b2e63af619f28bf3312" title="cached variable of my networ address">myNetwAddr</a> &lt;&lt; <span class="stringliteral">&quot; sending packet&quot;</span> &lt;&lt;std::endl;
    <span class="keywordflow">if</span>(<a class="code" href="a00117.html#a97a5c1c1f73f4255cabc4e292c4ad503" title="Test if a L3 address (pSrcAddr) is a broadcast address.">LAddress::isL3Broadcast</a>( netwAddr )) {
        coreEV &lt;&lt; <span class="stringliteral">&quot;sendDown: nHop=L3BROADCAST -&gt; message has to be broadcasted&quot;</span>
           &lt;&lt; <span class="stringliteral">&quot; -&gt; set destMac=L2BROADCAST\n&quot;</span>;
        macAddr = <a class="code" href="a00117.html#a9f975ad0433f1fb8a01164f266a41f62" title="Broadcast address for L2 addresses.">LAddress::L2BROADCAST</a>;
    }
    <span class="keywordflow">else</span>{
        coreEV &lt;&lt;<span class="stringliteral">&quot;sendDown: get the MAC address\n&quot;</span>;
        macAddr = <a class="code" href="a00028.html#a57d8927211b7979cf801038333ffdd50" title="Pointer to the arp module.">arp</a>-&gt;<a class="code" href="a00015.html#a793bf2888740e48020eacbceaac211c2" title="returns a L2 address to a given L3 address.">getMacAddr</a>(netwAddr);
    }

    <a class="code" href="a00028.html#a627a9f853785bc061b1423ac6ad9ad21" title="Attaches a &quot;control info&quot; (NetwToMac) structure (object) to the message pMsg.">setDownControlInfo</a>(pkt, macAddr);

    <span class="comment">//encapsulate the application packet</span>
    pkt-&gt;encapsulate(appPkt);
    coreEV &lt;&lt;<span class="stringliteral">&quot; pkt encapsulated\n&quot;</span>;
    <span class="keywordflow">return</span> pkt;
}
</pre></div>
</div>
</div>
<a class="anchor" id="a478dcd88ab7a82412deb8075afe61278"></a><!-- doxytag: member="BaseNetwLayer::handleLowerControl" ref="a478dcd88ab7a82412deb8075afe61278" args="(cMessage *msg)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void BaseNetwLayer::handleLowerControl </td>
          <td>(</td>
          <td class="paramtype">cMessage *&#160;</td>
          <td class="paramname"><em>msg</em></td><td>)</td>
          <td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Handle control messages from lower layer. </p>
<p>Redefine this function if you want to process control messages from lower layers.</p>
<p>This function currently handles one messagetype: TRANSMISSION_OVER. If such a message is received in the network layer it is deleted. This is done as this type of messages is passed on by the <a class="el" href="a00026.html" title="A very simple MAC module template which provides de- and encapsulation of messages using the standard...">BaseMacLayer</a>.</p>
<p>It may be used by network protocols to determine when the lower layers are finished sending a message. </p>

<p>Implements <a class="el" href="a00025.html#aa37925527fae20a5de1a755103056219">BaseLayer</a>.</p>

<p>Reimplemented in <a class="el" href="a00227.html#a03bea5d2e67da93c2abb61c2a54f109e">WiseRoute</a>, <a class="el" href="a00180.html#ad145699484af57f4f86319f4c62a9166">ProbabilisticBroadcast</a>, and <a class="el" href="a00089.html#afd79fff68c38e01a4c52c13c06c65a9a">DummyRoute</a>.</p>

<p>References <a class="el" href="a00026.html#a49e0e548a6c20d002bd67afa7b76c483a5e5e0e55f7cc75b0d8bad06a212371f1">BaseMacLayer::TX_OVER</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="keywordflow">switch</span> (msg-&gt;getKind())
  {
  <span class="keywordflow">case</span> <a class="code" href="a00026.html#a49e0e548a6c20d002bd67afa7b76c483a5e5e0e55f7cc75b0d8bad06a212371f1">BaseMacLayer::TX_OVER</a>:
    <span class="keyword">delete</span> msg;
    <span class="keywordflow">break</span>;
  <span class="keywordflow">default</span>:
    EV &lt;&lt; <span class="stringliteral">&quot;BaseNetwLayer does not handle control messages called &quot;</span>
       &lt;&lt; msg-&gt;getName() &lt;&lt; std::endl;
    <span class="keyword">delete</span> msg;
    <span class="keywordflow">break</span>;
  }
}
</pre></div>
</div>
</div>
<a class="anchor" id="a58afc64e0a96fe4d80d6b9f53cfd53c6"></a><!-- doxytag: member="BaseNetwLayer::handleLowerMsg" ref="a58afc64e0a96fe4d80d6b9f53cfd53c6" args="(cMessage *msg)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void BaseNetwLayer::handleLowerMsg </td>
          <td>(</td>
          <td class="paramtype">cMessage *&#160;</td>
          <td class="paramname"><em>msg</em></td><td>)</td>
          <td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Handle messages from lower layer. </p>
<p>Redefine this function if you want to process messages from lower layers before they are forwarded to upper layers</p>
<p>If you want to forward the message to upper layers please use <a class="el" href="a00025.html#adbf061566606041db811b519f0400ed5">sendUp</a> which will take care of decapsulation and thelike </p>

<p>Implements <a class="el" href="a00025.html#a5ca2278405070baa474dfbf059930247">BaseLayer</a>.</p>

<p>Reimplemented in <a class="el" href="a00227.html#a30099bfda16298ba45f76f4ba2fb0985">WiseRoute</a>, <a class="el" href="a00094.html#ac8c12c3b58ff0f5092b2326f694a509e">Flood</a>, <a class="el" href="a00180.html#afe7ebec835c0816b263c52a622a655da">ProbabilisticBroadcast</a>, <a class="el" href="a00089.html#a33f1e68f09911942c05a83bb913c9f30">DummyRoute</a>, and <a class="el" href="a00003.html#a2d8f30c81020c4b349a20fbfa4802f96">AdaptiveProbabilisticBroadcast</a>.</p>

<p>References <a class="el" href="a00028.html#a5e35aa24556a7cab9b6658889e98cb74">decapsMsg()</a>, and <a class="el" href="a00025.html#adbf061566606041db811b519f0400ed5">BaseLayer::sendUp()</a>.</p>
<div class="fragment"><pre class="fragment">{
    <a class="code" href="a00028.html#a70ef917f412c70e361b698d6989e677f" title="network packet pointer type.">netwpkt_ptr_t</a> m = <span class="keyword">static_cast&lt;</span><a class="code" href="a00028.html#a70ef917f412c70e361b698d6989e677f" title="network packet pointer type.">netwpkt_ptr_t</a><span class="keyword">&gt;</span>(msg);
    coreEV &lt;&lt; <span class="stringliteral">&quot; handling packet from &quot;</span> &lt;&lt; m-&gt;getSrcAddr() &lt;&lt; std::endl;
    <a class="code" href="a00025.html#adbf061566606041db811b519f0400ed5" title="Sends a message to the upper layer.">sendUp</a>(<a class="code" href="a00028.html#a5e35aa24556a7cab9b6658889e98cb74" title="decapsulate higher layer message from NetwPkt">decapsMsg</a>(m));
}
</pre></div>
</div>
</div>
<a class="anchor" id="a0b473fbb2517ac7b0c633afdb002c269"></a><!-- doxytag: member="BaseNetwLayer::handleUpperMsg" ref="a0b473fbb2517ac7b0c633afdb002c269" args="(cMessage *msg)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void BaseNetwLayer::handleUpperMsg </td>
          <td>(</td>
          <td class="paramtype">cMessage *&#160;</td>
          <td class="paramname"><em>msg</em></td><td>)</td>
          <td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Handle messages from upper layer. </p>
<p>Redefine this function if you want to process messages from upper layers before they are send to lower layers.</p>
<p>For the <a class="el" href="a00028.html" title="Base class for the network layer.">BaseNetwLayer</a> we just use the destAddr of the network message as a nextHop</p>
<p>To forward the message to lower layers after processing it please use <a class="el" href="a00025.html#a1873d6e3fc6d92cf8482b39f1c5ac6c8">sendDown</a>. It will take care of anything needed </p>

<p>Implements <a class="el" href="a00025.html#a8c0fcfb2e806357a65d5bdb1c338627b">BaseLayer</a>.</p>

<p>Reimplemented in <a class="el" href="a00227.html#aca0392ef347f060c9950238620245357">WiseRoute</a>, <a class="el" href="a00094.html#a37fea31a3b2493ee86f1b3efa7dd885a">Flood</a>, <a class="el" href="a00180.html#a7bf4d5846300082695448feb01b9899e">ProbabilisticBroadcast</a>, and <a class="el" href="a00089.html#afd462238bd49ed699157a22acc4b4d15">DummyRoute</a>.</p>

<p>References <a class="el" href="a00028.html#aad9d232f77fa033ffa2f1e7abe8e4af6">encapsMsg()</a>, and <a class="el" href="a00025.html#a1873d6e3fc6d92cf8482b39f1c5ac6c8">BaseLayer::sendDown()</a>.</p>
<div class="fragment"><pre class="fragment">{
  assert(dynamic_cast&lt;cPacket*&gt;(msg));
    <a class="code" href="a00025.html#a1873d6e3fc6d92cf8482b39f1c5ac6c8" title="Sends a message to the lower layer.">sendDown</a>(<a class="code" href="a00028.html#aad9d232f77fa033ffa2f1e7abe8e4af6" title="Encapsulate higher layer packet into an NetwPkt.">encapsMsg</a>(static_cast&lt;cPacket*&gt;(msg)));
}
</pre></div>
</div>
</div>
<a class="anchor" id="a627a9f853785bc061b1423ac6ad9ad21"></a><!-- doxytag: member="BaseNetwLayer::setDownControlInfo" ref="a627a9f853785bc061b1423ac6ad9ad21" args="(cMessage *const pMsg, const LAddress::L2Type &amp;pDestAddr)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cObject * BaseNetwLayer::setDownControlInfo </td>
          <td>(</td>
          <td class="paramtype">cMessage *const&#160;</td>
          <td class="paramname"><em>pMsg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="a00117.html#aea56b60dcb5ae8c2bde465271daf7210">LAddress::L2Type</a> &amp;&#160;</td>
          <td class="paramname"><em>pDestAddr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Attaches a "control info" (NetwToMac) structure (object) to the message pMsg. </p>
<p>This is most useful when passing packets between protocol layers of a protocol stack, the control info will contain the destination MAC address.</p>
<p>The "control info" object will be deleted when the message is deleted. Only one "control info" structure can be attached (the second setL3ToL2ControlInfo() call throws an error).</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">pMsg</td><td>The message where the "control info" shall be attached. </td></tr>
    <tr><td class="paramname">pDestAddr</td><td>The MAC address of the message receiver.</td></tr>
  </table>
  </dd>
</dl>
<p>Attaches a "control info" structure (object) to the down message pMsg. </p>

<p>References <a class="el" href="a00157.html#a9556c1d066423e39247217d7a7f2a456">NetwToMacControlInfo::setControlInfo()</a>.</p>

<p>Referenced by <a class="el" href="a00089.html#a20ab170f205c2834e998b7bbf91043c0">DummyRoute::encapsMsg()</a>, <a class="el" href="a00180.html#a3fe5edff45548230ba917138683fd6fa">ProbabilisticBroadcast::encapsMsg()</a>, <a class="el" href="a00094.html#a4576a635c66d17c2a4f05cc6ee524791">Flood::encapsMsg()</a>, <a class="el" href="a00028.html#aad9d232f77fa033ffa2f1e7abe8e4af6">encapsMsg()</a>, <a class="el" href="a00180.html#afe7ebec835c0816b263c52a622a655da">ProbabilisticBroadcast::handleLowerMsg()</a>, <a class="el" href="a00094.html#ac8c12c3b58ff0f5092b2326f694a509e">Flood::handleLowerMsg()</a>, <a class="el" href="a00227.html#a30099bfda16298ba45f76f4ba2fb0985">WiseRoute::handleLowerMsg()</a>, <a class="el" href="a00180.html#a617c3e0c1a2179b6b560c2286732b2ad">ProbabilisticBroadcast::handleSelfMsg()</a>, <a class="el" href="a00227.html#a4f0df1761deb1e98784b416ea17fc1e7">WiseRoute::handleSelfMsg()</a>, and <a class="el" href="a00227.html#aca0392ef347f060c9950238620245357">WiseRoute::handleUpperMsg()</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="keywordflow">return</span> <a class="code" href="a00157.html#a9556c1d066423e39247217d7a7f2a456" title="Attaches a &quot;control info&quot; structure (object) to the message pMsg.">NetwToMacControlInfo::setControlInfo</a>(pMsg, pDestAddr);
}
</pre></div>
</div>
</div>
<a class="anchor" id="a701bcbce5b46085ad3c987aecfd84010"></a><!-- doxytag: member="BaseNetwLayer::setUpControlInfo" ref="a701bcbce5b46085ad3c987aecfd84010" args="(cMessage *const pMsg, const LAddress::L3Type &amp;pSrcAddr)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cObject * BaseNetwLayer::setUpControlInfo </td>
          <td>(</td>
          <td class="paramtype">cMessage *const&#160;</td>
          <td class="paramname"><em>pMsg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="a00117.html#ad85cd9e8d9e7e9cd5d02dd740c4a12a4">LAddress::L3Type</a> &amp;&#160;</td>
          <td class="paramname"><em>pSrcAddr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Attaches a "control info" (NetwToUpper) structure (object) to the message pMsg. </p>
<p>This is most useful when passing packets between protocol layers of a protocol stack, the control info will contain the destination MAC address.</p>
<p>The "control info" object will be deleted when the message is deleted. Only one "control info" structure can be attached (the second setL3ToL2ControlInfo() call throws an error).</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">pMsg</td><td>The message where the "control info" shall be attached. </td></tr>
    <tr><td class="paramname">pSrcAddr</td><td>The MAC address of the message receiver.</td></tr>
  </table>
  </dd>
</dl>
<p>Attaches a "control info" structure (object) to the up message pMsg. </p>

<p>References <a class="el" href="a00155.html#a8e95c523ae2e3136ab34313da7384dea">NetwControlInfo::setControlInfo()</a>.</p>

<p>Referenced by <a class="el" href="a00089.html#a04dfae1582e817482ed118d1325f082d">DummyRoute::decapsMsg()</a>, <a class="el" href="a00028.html#a5e35aa24556a7cab9b6658889e98cb74">decapsMsg()</a>, and <a class="el" href="a00227.html#a679068365891c8fd94c37fd43976c0fd">WiseRoute::decapsMsg()</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="keywordflow">return</span> <a class="code" href="a00155.html#a8e95c523ae2e3136ab34313da7384dea" title="Attaches a &quot;control info&quot; structure (object) to the message pMsg.">NetwControlInfo::setControlInfo</a>(pMsg, pSrcAddr);
}
</pre></div>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>D:/Projects/MiXiM/extsrc/mixim/src/base/modules/<a class="el" href="a00274_source.html">BaseNetwLayer.h</a></li>
<li>D:/Projects/MiXiM/extsrc/mixim/src/base/modules/BaseNetwLayer.cc</li>
</ul>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="a00028.html">BaseNetwLayer</a>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:31 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
